<%--
  Created by IntelliJ IDEA.
  User: 兰宦君
  Date: 2015/10/12
  Time: 10:50
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<html>
<head>
  <meta charset="utf-8" />
  <title>BookStore——我的网上书店</title>
  <%@ include file="../layout/import.jsp"%>


  <script language="JavaScript">
    function orderBook(bookid) {
      $.ajax({
        url: "/orderbook.do",
        data: {id:bookid},
        method: "POST",
        dataType: "json",
        error: function () {
          alert("表单提交出错，请稍后再试");
        },
        success: function(response) {
          if(response.code == 0) {
            window.location.href = "/orderbook.do";
          }
          else {
            alert(response.description);
          }
        }
      });
    }
  </script>
</head>
<body>
<%@include file="nav.jsp"%>

<div class="container">

      <div class="row" id="bookshow" style="min-height: 75%">
        <c:forEach var="book" items="${bookList}">
          <div class="col-xs-6 col-lg-4">
            <h2>
                ${book.bookname}
            </h2>
            <p>
                <a href="/bookDetail.do?id=${book.id}"><img style="width: 200px; height: 400px" src="${book.picture}"class="img-thumbnail"></a>
            </p>
            <p>
                <a href="/bookDetail.do?id=${book.id}" class="btn btn-default" role="button">详细&raquo;</a>
            </p>
          </div>
        </c:forEach>
      </div><!--/row-->
    </div>
  </div>
</div>

<%@include file="footer.jsp"%>
</body>

</html>
